package view;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;

import javax.swing.JComponent;

import modelImp.Pawn;
import modelImp.Player;

public class PawnComponent extends JComponent{
	private Pawn pawn;
	public PawnComponent(Pawn p)
	{
		super();
		this.setSize(32,32);
		this.pawn = p;
		this.setVisible(true);
		this.setEnabled(true);
		
	}
	
	public void drawPawnComponent(Graphics g){
		g.drawImage(this.getImage(),this.getX(), this.getY(), this.getWidth(), this.getHeight(), null);
	}
	protected void paintComponent(Graphics g) {
		Graphics2D g2d = (Graphics2D)g;
		super.paintComponent(g);
		g2d.drawImage(((Player)(pawn.getPlayer())).getImage(),0,0,78,78,null);
	}
	public Pawn getPawn(){
		return this.pawn;
	}
	public Image getImage(){
		return ((Player)(this.pawn.getPlayer())).getImage();
	}

}
